import request from '@/utils/request'

/**
 * 分页查询客户
 */
export function getCustomerPage(params) {
  return request({
    url: '/customer/page',
    method: 'get',
    params
  })
}

/**
 * 查询所有客户
 */
export function getCustomerList() {
  return request({
    url: '/customer/list',
    method: 'get'
  })
}

/**
 * 根据ID查询客户
 */
export function getCustomerById(id) {
  return request({
    url: `/customer/${id}`,
    method: 'get'
  })
}

/**
 * 获取客户详情（含车辆、保养、维修记录）
 */
export function getCustomerDetail(id) {
  return request({
    url: `/customer/${id}/detail`,
    method: 'get'
  })
}

/**
 * 新增客户
 */
export function addCustomer(data) {
  return request({
    url: '/customer',
    method: 'post',
    data
  })
}

/**
 * 更新客户
 */
export function updateCustomer(data) {
  return request({
    url: '/customer',
    method: 'put',
    data
  })
}

/**
 * 删除客户
 */
export function deleteCustomer(id) {
  return request({
    url: `/customer/${id}`,
    method: 'delete'
  })
}

